home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / gnulib / ohlutil / getversi.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-24  |  2.2 KB  |  77 lines

  1. /* getversion.c -- select backup filename type
  2.    Copyright (C) 1990 Free Software Foundation, Inc.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 1, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. /* Written by David MacKenzie <djm@ai.mit.edu> */
  19.  
  20. /*
  21.  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  22.  *
  23.  * To this port, the same copying conditions apply as to the
  24.  * original release.
  25.  *
  26.  * IMPORTANT:
  27.  * This file is not identical to the original GNU release!
  28.  * You should have received this code as patch to the official
  29.  * GNU release.
  30.  *
  31.  * MORE IMPORTANT:
  32.  * This port comes with ABSOLUTELY NO WARRANTY.
  33.  *
  34.  * $Header: e:/gnu/fileutil/RCS/getversi.c'v 1.3.0.2 90/06/29 00:46:47 tho Stable $
  35.  */
  36.  
  37. #include "backupfile.h"
  38.  
  39. #ifdef MSDOS
  40. extern enum backup_type get_version (char *version);
  41. extern int argmatch (char *arg, char **optlist);
  42. extern void invalid_arg (char *kind, char *value, int problem);
  43. #else /* not MSDOS */
  44. int argmatch ();
  45. void invalid_arg ();
  46. #endif /* not MSDOS */
  47.  
  48. extern char *program_name;
  49.  
  50. static char *backup_args[] =
  51. {
  52.   "never", "simple", "nil", "existing", "t", "numbered", 0
  53. };
  54.  
  55. static enum backup_type backup_types[] =
  56. {
  57.   simple, simple, numbered_existing, numbered_existing, numbered, numbered
  58. };
  59.  
  60. /* Return the type of backup indicated by VERSION.
  61.    Unique abbreviations are accepted. */
  62.  
  63. enum backup_type
  64. get_version (version)
  65.      char *version;
  66. {
  67.   int i;
  68.  
  69.   if (version == 0 || *version == 0)
  70.     return numbered_existing;
  71.   i = argmatch (version, backup_args);
  72.   if (i >= 0)
  73.     return backup_types[i];
  74.   invalid_arg ("version control type", version, i);
  75.   return numbered_existing;
  76. }
  77.